<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class UserCouponTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_coupon', function (Blueprint $table) {
            $table->integerIncrements('id');
            $table->integer('user_id')->comment('用户ID');
            $table->integer('company_id')->default(1)->comment('公司ID');
            $table->integer('activity_id', false, true)->default(0)->nullable()->comment('活动ID');
            $table->integer('coupon_id', false, true)->comment('优惠券ID');
            $table->integer('use_time', false, true)->nullable()->default(0)->comment('使用时间');
            $table->integer('receive_time', false, true)->nullable()->default(0)->comment('领取时间');
            $table->integer('overdue_time', false, true)->nullable()->default(0)->comment('过期时间');
            $table->tinyInteger('from', false, true)->default(1)->comment('来源 1-领取 2-系统发放');
            $table->tinyInteger('status',false, true)->comment('状态 0-待领取 1-正常 2-已使用');

            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_coupon');
    }
}
